home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung
/
Power-Programmierung (Tewi)(1994).iso
/
magazine
/
spoc88
/
cengn
/
engine.c
< prev
next >
Wrap
Text File
|
1988-06-22
|
2KB
|
50 lines
/************************************************************
ENGINE.C - by Jake Richter
Provides core routine for a search engine that searches
the current directory for a given file name (which may
contain wildcards) with specific attributes. When a file is
found, the engine calls a function whose pointer it is
passed upon entry with the contents of the DTA returned by
the Find First and Find Next functions.
************************************************************/
#include "dos.h" /* Contains ffblk structure. */
#include "dir.h" /* Required by findfirst, findnext,
getcwd. */
/************************************************************
Program Definitions
************************************************************/
#define FALSE 0
#define TRUE !FALSE
typedef struct ffblk FFBLK;
/************************************************************
Mandatory Global Declarations
************************************************************/
static FFBLK procBlock; /* Declare a file info block
for the specific procs.*/
/************************************************************
void SearchEngine(filename, attribute, procPtr)
This routine sets up the call for the recursive tree
search routine and the search engine.
************************************************************/
void SearchEngine(filename, attribute, procPtr)
char *filename;
char attribute;
void (*procPtr)();
{
int done;
done = findfirst(filename, &procBlock, attribute);
/* While there are still matching files... */
while (!done)
{
(*procPtr)(&procBlock); /* Call the user's function. */
done = findnext(&procBlock); /* Search again. */
}
return;
}